package com.slz3.business.module.goodsManagement.gooAttributeValue.steward;

import com.slz3.business.frame.response.RR;
import com.slz3.business.frame.response.ResInfo;
import com.slz3.business.module.goodsManagement.gooAttributeValue.domain.GooAttributeValue;
import com.slz3.business.module.goodsManagement.gooAttributeValue.domain.GooAttributeValueCondition;
import org.springframework.stereotype.Controller;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

import javax.annotation.Resource;

@Controller
public class GooAttributeValueResController{

    @Resource
    private GooAttributeValueResAtomic gooAttributeValueResAtomic;

    public Mono<ServerResponse> add(ServerRequest req, GooAttributeValue gooAttributeValue) {
        if (GooAttributeValueResUnsafeValid.add(req, gooAttributeValue)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return gooAttributeValueResAtomic.add_$GooAttributeValueUpdateLock(req, gooAttributeValue);
        }
    }

    public Mono<ServerResponse> delete(ServerRequest req, GooAttributeValueCondition gooAttributeValueCondition) {
        if (GooAttributeValueResUnsafeValid.delete(req, gooAttributeValueCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return gooAttributeValueResAtomic.delete_$GooAttributeValueUpdateLock(req, gooAttributeValueCondition);
        }
    }

    public Mono<ServerResponse> modify(ServerRequest req, GooAttributeValue gooAttributeValue) {
        if (GooAttributeValueResUnsafeValid.modify(req, gooAttributeValue)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return gooAttributeValueResAtomic.modify_$GooAttributeValueUpdateLock(req, gooAttributeValue);
        }
    }

    public Mono<ServerResponse> list(ServerRequest req) {
        if (GooAttributeValueResUnsafeValid.list(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return GooAttributeValueResExecutor.list(req);
        }
    }

    public Mono<ServerResponse> info(ServerRequest req) {
//        return gooAttributeValueResAtomic.info_$GooAttributeValueUpdateLock(req);
        if (GooAttributeValueResUnsafeValid.info(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return gooAttributeValueResAtomic.info_$GooAttributeValueUpdateLock(req);
        }
    }

    public Mono<ServerResponse> choice(ServerRequest req) {
        if (GooAttributeValueResUnsafeValid.choice(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return GooAttributeValueResExecutor.choice(req);
        }
    }

    public Mono<ServerResponse> auditSubmit(ServerRequest req, GooAttributeValueCondition gooAttributeValueCondition) {
        //
        if (GooAttributeValueResUnsafeValid.auditSubmit(req, gooAttributeValueCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return gooAttributeValueResAtomic.auditSubmit_$GooAttributeValueUpdateLock(req, gooAttributeValueCondition);
        }
    }

    public Mono<ServerResponse> audit(ServerRequest req, GooAttributeValueCondition gooAttributeValueCondition) {
        if (GooAttributeValueResUnsafeValid.audit(req, gooAttributeValueCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return gooAttributeValueResAtomic.audit_$GooAttributeValueUpdateLock(req, gooAttributeValueCondition);
        }
    }

    public Mono<ServerResponse> auditReject(ServerRequest req, GooAttributeValueCondition gooAttributeValueCondition) {
        if (GooAttributeValueResUnsafeValid.auditReject(req, gooAttributeValueCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return gooAttributeValueResAtomic.auditReject_$GooAttributeValueUpdateLock(req, gooAttributeValueCondition);
        }
    }

    public Mono<ServerResponse> usingEnable(ServerRequest req, GooAttributeValueCondition gooAttributeValueCondition) {
        if (GooAttributeValueResUnsafeValid.usingEnable(req, gooAttributeValueCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return gooAttributeValueResAtomic.usingEnable_$GooAttributeValueUpdateLock(req, gooAttributeValueCondition);
        }
    }

    public Mono<ServerResponse> usingDisable(ServerRequest req, GooAttributeValueCondition gooAttributeValueCondition) {
        if (GooAttributeValueResUnsafeValid.usingDisable(req, gooAttributeValueCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return gooAttributeValueResAtomic.usingDisable_$GooAttributeValueUpdateLock(req, gooAttributeValueCondition);
        }
    }

}
